<!--
*@Author: QWP
*@Description: 部门资产
*@Date: 2024-07-08 09:51:28
-->
<template>
  <a-layout class="f-h-100 s-bg-white" id="test">
    <u-search-header>
      <u-form
        :model="searchF"
        :gutter="16"
        :elements="searchEl"
        class="f-w-auto">
        <a-col>
          <a-space>
            <u-icon-button>查询</u-icon-button>
            <u-icon-button itype="export">导出</u-icon-button>
          </a-space>
        </a-col>
      </u-form>
    </u-search-header>
    <a-layout-content class="f-padding-rl24">
      <u-table
        :columns="columns"
        :data="tabData"
        v-model:pagination="pagenation"></u-table>
    </a-layout-content>
  </a-layout>
</template>

<script lang="ts" setup>
import { ref, reactive, computed, onMounted, h, watch } from "vue";
import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave} from "vue-router";
import { _IFormEl } from "@/components/common/form/interface";
import { ColProps, FormItemProps, TableColumnProps } from "ant-design-vue";
import { CheckCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { numberC } from '@/util/common'
import { formatAmt, } from '@/util/format.ts'
import dayjs from "dayjs";
import { cloneDeep } from 'lodash'
import { TreeProps } from "ant-design-vue/es/vc-tree";
const route = useRoute();
const router = useRouter();

onMounted(() => {
  initCols();
})

let pagenation = reactive({
  total: 0,
  current: 1,
  pageSize: 50,
  showTotal: total => `共 ${total} 条`
})
const searchF = reactive({
  model: {
    fwzh: "",
    fwzh1: "",
  },
});
const formItemProps: FormItemProps = {
  labelCol: { span: 8 },
  wrapperCol: { span: 16 },
};
const searchEl: Array<_IFormEl> = [
  { label: "资产状态：", key: "status", element: "select", col: { span: 4 }, 
    formItemProps: formItemProps,
    componentProps: {
      options: [
        { label: '再用', value: '1' },
        { label: '未使用', value: '2' },
        { label: '不需要', value: '3' },
      ]
    }
  },
  { label: "关键字", key: "option", element: "input", col: { span: 4 }, formItemProps: formItemProps, },
];

// 列表
const tabData = reactive([
  { bqzt: '未写入', zcbm: 'zc-0025421132156', szcmcqr: '救援车辆', zcdl: '车辆', 
    flmc: '其他办公设备', ggxh: '', jz: '1000', rzrq: '2024-06-01', b7: '再用'
  },
  { bqzt: '未写入', zcbm: 'zc-0025421132156', szcmcqr: '救援车辆', zcdl: '车辆', 
    flmc: '其他办公设备', ggxh: '', jz: '1000', rzrq: '2024-06-01', b7: '再用'
  },
]);
let columns: Array<TableColumnProps> = reactive([
  { dataIndex: "bqzt", title: "标签状态", width: 150 },
  { dataIndex: "zcbm", title: "资产编码", width: 150 },
  { dataIndex: "zcmc", title: "资产名称", width: 150 },
  { dataIndex: "zcdl", title: "资产大类", width: 150 },
  { dataIndex: "flmc", title: "分类名称", width: 150 },
  { dataIndex: "ggxh", title: "规格型号", width: 150 },
  { dataIndex: "jz", title: "价值(元)", width: 150 },
  { dataIndex: "rzrq", title: "入账日期", width: 150 },
  { dataIndex: "b7", title: "使用状态", width: 150, fixed: 'right' },
]);

// 初始化列表表头
const initCols = () => {
  return
  let tCols = cloneDeep(originCols)
  if(['DocDraft', 'DocRed'].includes(route.name)) {
    tCols = tCols.filter(item => item.dataIndex != 'status')
  }
  columns.splice(0, columns.length, ...tCols)
}

</script>

<style lang="scss" scoped>
.icons-list :deep(.anticon) {
  margin-right: 6px;
  font-size: 24px;
}
</style>
